]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st-texture-cache: Use GSlice to manage memory of leaders data
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Wed, 27 Feb 2019 02:48:43 +0000 (03:48 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Fri, 1 Mar 2019 17:12:53 +0000 (17:12 +0000)
This allows some memory optimizations when possible, so let's use it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5

src/st/st-texture-cache.c

index 6da186fba4a9c72085b3a3d252d059cf9eca4648..a9688ec60b4765548a26a53048233e7fb0371be1 100644 (file)
@@ -315,7 +315,7 @@ texture_load_data_free (gpointer p)
   if (data->actors)
     g_slist_free_full (data->actors, (GDestroyNotify) g_object_unref);
 
-  g_free (data);
+  g_slice_free (AsyncTextureLoadData, data);
 }
 
 /**
@@ -751,7 +751,7 @@ st_texture_cache_free_bind (gpointer data)
   StTextureCachePropertyBind *bind = data;
   if (bind->weakref_active)
     g_object_weak_unref (G_OBJECT (bind->actor), st_texture_cache_bind_weak_notify, bind);
-  g_free (bind);
+  g_slice_free (StTextureCachePropertyBind, bind);
 }
 
 /**
@@ -782,7 +782,7 @@ st_texture_cache_bind_cairo_surface_property (StTextureCache    *cache,
   actor = create_invisible_actor ();
   clutter_actor_set_size (actor, size, size);
 
-  bind = g_new0 (StTextureCachePropertyBind, 1);
+  bind = g_slice_new0 (StTextureCachePropertyBind);
   bind->cache = cache;
   bind->actor = actor;
   bind->size = size;
@@ -880,7 +880,7 @@ ensure_request (StTextureCache        *cache,
   if (pending == NULL)
     {
       /* Not cached and no pending request, create it */
-      *request = g_new0 (AsyncTextureLoadData, 1);
+      *request = g_slice_new0 (AsyncTextureLoadData);
       if (policy != ST_TEXTURE_CACHE_POLICY_NONE)
         g_hash_table_insert (cache->priv->outstanding_requests, g_strdup (key), *request);
     }
@@ -1096,7 +1096,7 @@ on_data_destroy (gpointer data)
   g_object_unref (d->gfile);
   g_object_unref (d->actor);
   g_object_unref (d->cancellable);
-  g_free (d);
+  g_slice_free (AsyncImageData, d);
 }
 
 static void
@@ -1261,7 +1261,7 @@ st_texture_cache_load_sliced_image (StTextureCache *cache,
   g_assert (paint_scale > 0);
   g_assert (resource_scale > 0);
 
-  data = g_new0 (AsyncImageData, 1);
+  data = g_slice_new0 (AsyncImageData);
   data->grid_width = grid_width;
   data->grid_height = grid_height;
   data->paint_scale = paint_scale;